package com.x.service.entity.map;

import com.x.service.entity.BookList;
import com.x.service.entity.BookListsBean;
import com.x.zssqservice.bean.Rankings;

import java.util.ArrayList;

/**
 * Created by H on 18/5/9.
 */

public class RankingsToBookList implements IMap<Rankings, BookList> {
    @Override
    public BookList map(Rankings rankings) {
        BookList bookList = new BookList();
        bookList.books = new ArrayList<>();
        bookList.ok = rankings.ok;
        for (Rankings.RankingBean.BooksBean tagBook : rankings.ranking.books) {
            BookListsBean bookListsBean = new BookListsBean();
            bookListsBean._id = tagBook._id;
            bookListsBean.title = tagBook.title;
            bookListsBean.author = tagBook.author;
            bookListsBean.cover = IMG_BASE_URL + tagBook.cover;
            bookListsBean.shortIntro = tagBook.shortIntro;
            bookListsBean.latelyFollower = tagBook.latelyFollower;
            bookListsBean.updated = tagBook.updated;
//            bookListsBean.isSerial = tagBook.;
            bookList.books.add(bookListsBean);
        }
        return bookList;
    }
}
